//
//  ViewController.m
//  05-UIScrollViewTest
//
//  Created by QC.L on 16/7/20.
//  Copyright © 2016年 QC.L. All rights reserved.
//

#import "ViewController.h"
#import "TestView.h"
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
@interface ViewController () <UIScrollViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSArray *imageArray = @[@"guidePage_01", @"guidePage_02", @"guidePage_03", @"guidePage_04"];
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:scrollView];
    scrollView.contentSize = CGSizeMake(kScreenWidth * imageArray.count, 0);
    scrollView.pagingEnabled = YES;
    scrollView.bounces = NO;
    for (int i = 0; i < imageArray.count; i++) {
        UIScrollView *smallScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(i * kScreenWidth, 0, kScreenWidth, kScreenHeight)];
        smallScrollView.delegate = self;
        smallScrollView.minimumZoomScale = 1;
        smallScrollView.maximumZoomScale = 2;
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
        imageView.image = [UIImage imageNamed:imageArray[i]];
        [smallScrollView addSubview:imageView];
        [scrollView addSubview:smallScrollView];
    }
    NSLog(@"^111");
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    return [scrollView.subviews firstObject];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
